package com.atguigu;

import java.io.File;

/**
 * @program: IDEAcode
 * @description:
 * @author: Mr.zjx
 * create: 2021-08-16-19-06
 **/
public class Test6 {
    public static void main(String[] args) {
        File parent = new File("G:\\尚硅谷学习\\学习视频\\Java及数据库\\day19\\笔记\\mytxt");
        File file = new File(parent,"1.txt");
        //判断文件是否删除
        boolean delete = parent.delete();
        System.out.println("delete = " + delete);
        //判断文件是否存在
        boolean exists = parent.exists();
        System.out.println("exists = " + exists);
        //判断是不是文件夹
        boolean directory = parent.isDirectory();
        System.out.println("directory = " + directory);
        String path = parent.getPath();
        System.out.println("path = " + path);
        //获取父路径
        File parentFile = parent.getParentFile().getParentFile().getParentFile();
        System.out.println("parentFile = " + parentFile);
        System.out.println("file = " + file);
    }
}
